]> git.r.bdr.sh - rbdr/Flat-Bezel.qsplugin/blob - Flat Bezel/BackgroundView.swift
Improve drawing, add padding to bezel
[rbdr/Flat-Bezel.qsplugin] / Flat Bezel / BackgroundView.swift
1 //
2 // BBBackgroundView.swift
3 // Flat Bezel
4 //
5 // Created by Ruben Beltran del Rio on 2/8/23.
6 // Copyright © 2023 BRNBW. All rights reserved.
7 //
8
9 import Foundation
10 import Cocoa
11
12 class BackgroundView: QSBezelBackgroundView {
13
14 override func draw(_ rect: NSRect) {
15 let boundsRect = self.bounds
16
17 let roundRect = NSBezierPath()
18 roundRect.appendRoundedRect(boundsRect, xRadius: 8.0, yRadius: 8.0)
19 roundRect.addClip()
20
21 let darkMode = self.effectiveAppearance.name == .darkAqua
22 if (darkMode) {
23 NSColor(red: 0.1, green: 0.1, blue: 0.1, alpha: 0.99).setFill()
24 } else {
25 NSColor(red: 1, green: 1, blue: 1, alpha: 0.99).setFill()
26 }
27 boundsRect.fill(using: .copy)
28
29 super.draw(boundsRect)
30 }
31 }